{template "mheader.html"}
<link href="{THEME_PATH}assets/global/plugins/bootstrap-daterangepicker/daterangepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css" rel="stylesheet" type="text/css" />
<link href="{THEME_PATH}assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" type="text/css" />
<script src="{THEME_PATH}assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.finecms.js" type="text/javascript"></script>
<script src="{THEME_PATH}assets/mall/js/mall.js" type="text/javascript"></script>
<link href="{THEME_PATH}assets/mall/css/mall.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
    if (App.isAngularJsApp() === false) {
        jQuery(document).ready(function() {
            if (jQuery().datepicker) {
                $('.date-picker').datepicker({
                    rtl: App.isRTL(),
                    orientation: "left",
                    autoclose: true
                });
            }
        });
    }
</script>
<div class="row table-search-tool">
    <form action="{SELF}" method="get">
        {dr_form_search_hidden(['app' => 'order'])}
        <div class="col-md-12 col-sm-12">
            <label>
                <select name="field" class="form-control">
                    {loop $field $t}
                    {if $t.ismain}
                    <option value="{$t.fieldname}" {if $param.field==$t.fieldname}selected{/if}>{$t.name}</option>
                    {/if}
                    {/loop}
                </select>
            </label>
            <label><i class="fa fa-caret-right"></i></label>
            <label><input type="text" class="form-control" placeholder="" value="{$param['keyword']}" name="keyword" /></label>
            <label style="margin-bottom: -12px;">
                <div class="input-group input-medium date-picker input-daterange" data-date="" data-date-format="yyyy-mm-dd">
                    <input type="text" class="form-control" value="{$param.date_form}" name="date_form">
                    <span class="input-group-addon"> 到 </span>
                    <input type="text" class="form-control" value="{$param.date_to}" name="date_to">
                </div>
            </label>
            <label>
                <button style="margin-bottom: 2px;" type="submit" class="btn green btn-sm onloading" name="submit" > <i class="fa fa-search"></i> 搜索</button>
            </label>
        </div>
    </form>
</div>
<div class="portlet-title tabbable-line" style="margin-top:10px">
    <ul class="nav nav-tabs">
        {loop $type $i $t}
        <li class="{if $param.tid==$i}active{/if}">
            <a href="{$t.url}"> {$t.icon} {$t.name} </a>
        </li>
        {/loop}
    </ul>
</div>

<form class="form-horizontal" role="form" id="myform" style="margin-top:20px">
    {dr_form_hidden()}
    <div class="table-scrollable">
        <table class="table table-striped table-bordered table-checkable dataTable">
            <thead>
            <tr class="heading">
                <th width="200" class="{dr_sorting('id')}" name="id">订单编号</th>
                <th width="130" class="{dr_sorting('name')}" name="name">收货人</th>
                <th width="130" class="{dr_sorting('money')}" name="money">金额</th>
                <th width="200" style="text-align:center" class="{dr_sorting('status')}" name="status">订单状态</th>
                <th width="170" class="{dr_sorting('inputtime')}" name="inputtime">下单时间</th>
                <th>{dr_lang('操作')}</th>
            </tr>
            </thead>
            <tbody>
            {loop $list $t}
            <tr class="odd gradeX">
                <td> <a href="javascript:dr_mall_table_more({$t.id});" style="margin-right:5px">{$t.sn}</a> {dr_mall_order_source($t.source)}</td>
                <td>{$t.name}</td>
                <td class="price">￥{number_format($t.money, 2)}</td>
                <td style="text-align:center"><a href="{dr_member_url($uriprefix.'/show', ['id'=>$t.id])}">{order_info_status($t)}</a></td>
                <td>{dr_date($t.inputtime, 'Y-m-d H:i:s', 'red')}</td>
                <td>
                    <label><a href="{dr_member_url($uriprefix.'/show', ['id'=>$t.id])}" class="btn btn-xs green"> <i class="fa fa-edit"></i> {dr_lang('详情')}</a></label>
                    {if $t.status!=0}
                        {if $t.pay_status==0}
                        <label><a href="{dr_url('order/buy/index', ['id'=>$t.id])}" target="_blank" class="btn btn-xs red"> <i class="fa fa-rmb"></i> {dr_lang('付款')}</a></label>
                        {/if}
                        {if $t.deliver_status==1}
                        <label><a href="javascript:;" onclick="dr_ajax_confirm_url('{dr_member_url('order/operation/delivery', ['id'=>$t.id])}','确定收到货物了吗？',  '{FC_NOW_URL}')" class="btn btn-xs blue"> <i class="fa fa-check-circle"></i> {dr_lang('收货')}</a></label>
                        {/if}
                    {if $t.status==1}
                        {if $t.pay_status == 0}
                        <label><a href="javascript:;" onclick="dr_iframe('关闭订单', '{dr_member_url('order/operation/close', ['id'=>$t.id])}')" class="btn btn-xs red"> <i class="fa fa-times-circle"></i> {dr_lang('关闭')}</a></label>
                        {else}
                        <label><a href="javascript:;" onclick="" class="btn btn-xs red"> <i class="fa fa-check-circle"></i> {dr_lang('退款')}</a></label>
                        {/if}
                    {/if}
                        {if $t.status==9 && $t.comment==0}
                        <label><a href="{dr_member_url($uriprefix.'/comment', ['id'=>$t.id])}" class="btn btn-xs blue"> <i class="fa fa-comments"></i> {dr_lang('评价')}</a></label>
                        {/if}
                    <label><a href="{dr_member_url('order/service/order', ['id'=>$t.id])}" class="btn btn-xs red"> <i class="fa fa-user-md"></i> {dr_lang('售后')}</a></label>
                    {/if}
                </td>
            </tr>
            <tr class="dr_table_more dr_table_{$t.id}" style="display: none;">
                <td colspan="6" class="row" style="padding:0">
                    <div class="col-md-7 table-items-body">
                        <table class="table table-light table-items">
                            <tbody>
                            {loop $t.goods $item}
                            <tr>
                                <td width="120"> <a href="{$item.url}" target="_blank"><img width="100" src="{dr_get_file($item.thumb)}"></a></td>
                                <td class="table-items-last-child">
                                    {$item.title}
                                    {php $sku = dr_string2array($item.sku_name);}
                                    {if $sku}
                                    <p>
                                        {loop $sku $n $v}
                                        <label>{$n}：{$v}</label>
                                        {/loop}
                                    </p>
                                    {/if}
                                    <p>
                                        x{$item.num}
                                    </p>
                                </td>
                            </tr>
                            {/loop}
                            </tbody>
                        </table>
                    </div>
                    <div class="col-md-5 text-left table-items-address">
                        {if count($t.goods) > 1}
                        <p>{$t.name}</p>
                        <p>{$t.phone}</p>
                        {else}
                        <p>{$t.name} &nbsp;&nbsp;{$t.phone}</p>
                        {/if}
                        <p>{$t.email}</p>
                        <p>{$t.address}</p>
                    </div>
                </td>
            </tr>
            {/loop}
            </tbody>
        </table>
    </div>

    <div class="row fc-list-footer table-checkable ">
        <div class="col-md-12 fc-list-page">
            {$mypages}
        </div>
    </div>
</form>


{template "mfooter.html"}